<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<script type="text/javascript">
    //Datatable
    $.extend($.fn.dataTable.defaults, {
        responsive: true,
        serverSide: true,
        processing: true,
        ordering: true,/* 排序 */
        searching: false/* 不开启本地搜索 */
    });

    function flatten(params) {
        params.columns.forEach(function (column, index) {
            params['columns[' + index + '].data'] = column.data;
            params['columns[' + index + '].name'] = column.name;
            params['columns[' + index + '].searchable'] = column.searchable;
            params['columns[' + index + '].orderable'] = column.orderable;
            params['columns[' + index + '].search.regex'] = column.search.regex;
            params['columns[' + index + '].search.value'] = column.search.value;
        });
        delete params.columns;

        params.order.forEach(function (order, index) {
            params['order[' + index + '].column'] = order.column;
            params['order[' + index + '].dir'] = order.dir;
        });
        delete params.order;

        params['search.regex'] = params.search.regex;
        params['search.value'] = params.search.value;
        delete params.search;

        return params;
    }
</script>
